<?php
namespace app\exam\validate;

use think\Validate;

/**
 * 订单验证
 */
class Order extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'    =>    ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'id'         => 'require|integer',
        'paper_id'   => 'require|integer',
        'special_id' => 'require|integer',
        'rollup_id'  => 'require|integer',
    ];

    protected $field = [
        'id'         => '公开考试',
        'paper_id'   => '公开考试',
        'special_id' => '专项练习',
        'rollup_id'  => '套卷练习',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'    =>    '错误信息'
     *
     * @var array
     */
    protected $message = [
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'paper_fetch'       => ['paper_id', 'id'],
        'paper_order'       => ['paper_id', 'id'],
        'special_fetch'     => ['special_id'],
        'special_order'     => ['special_id'],
        'rollup_fetch'      => ['rollup_id'],
        'rollup_order'      => ['rollup_id'],
        
    ];

}
